import random
if __name__ == "__main__":
    n = input("请输入您的序列个数n,以及max和min之差的最大值x,用空格隔开!")
    n = n.split(' ')
    n,x = int(n[0]),int(n[1])
    num_list = []
    for i in range(n):
        num_list.append(random.randint(1,10000))
    len1 = len(num_list)
    d = 0
    while d==0:
        for g in range(random.randint(1, n)):
            num_list.pop()
        if max(num_list) - min(num_list) > x:
            d = len1-len(num_list)
    else:
        print(d)